package com.woniuxy.yoga.business.web.controller;

import com.woniuxy.yoga.business.service.StoreCountService;
import com.woniuxy.yoga.business.web.controller.util.xxlUtil;
import com.woniuxy.yoga.commons.core.model.Result;
import com.xxl.job.core.handler.annotation.XxlJob;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

@Component
public class XxlJobTask {
    @Autowired
    private StoreCountService storeCountService;

    /**
     * 每月1号1点定时统计月营业额
     */
    @XxlJob("timingStoreCount")
    public void timingStoreCount() throws Exception {
        storeCountService.timingStoreCount();
    }


    /**
     * 添加定时任务
     * @return
     */
    public Result<String> addTackTow(){
        xxlUtil.addTackTow("每月1号定时统计月营业额","pengyuyan","timingStoreCount");
        return Result.getResult(String.class).setMessage("成功");
    }

}
